package com.itcast.database.smooth.config;


public enum DatasourceEnum {

    TABLE_ORDER("t_trade_order", "订单表"),
    DATASOURCE_PREFIX("ds_", "数据源前缀"),
    DATASOURCE_1("ds_0", "第一个数据源"),
    DATASOURCE_2("ds_1", "扩展第二个数据源"),
    ;

    private final String value;
    private final String desc;

    DatasourceEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return this.value;
    }

    /**
      * 根据value 获取枚举
      */
    public static DatasourceEnum getByValue(Integer value) {
        for (DatasourceEnum carSpaceTypeEnum : values()) {
            if (carSpaceTypeEnum.getValue() .equals(value) ) {
                //获取指定的枚举
                return carSpaceTypeEnum;
            }
        }
        return null;
    }
}
